package com.lfy.aop;

import com.lfy.annotation.Log;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Component
@Slf4j
@Aspect
public class LogAspect {
    @Pointcut("@annotation(log)")
    public void logCut(Log log){

    }
    @SneakyThrows
    @Around("logCut(log)")
    public Object haha(ProceedingJoinPoint point,Log log){
        System.out.println(log.method());
        System.out.println(log.value());
        System.out.println("log");
        return point.proceed();
    }
}
